In a database management system (DBMS), data is stored in one or more data containers. Each container contains records. The data within each record is organized into one or more fields. In relational database management systems, the data containers are referred to as tables, the records are referred to as rows, and the fields are referred to as columns. In object-oriented databases, the data containers are referred to as object classes, the records are referred to as objects, and the fields are referred to as attributes. Other database architectures may use other terminology.
Database management systems retrieve information in response to receiving queries that specify the information to retrieve. In order for a database management system to understand the query, the query should conform to a database language recognized by the database management system, such as the Structured Query Language (SQL).
The data that is stored within a database table may be data that was obtained automatically from a set of similarly structured XML documents. Each XML document in a group of similarly structured XML documents may conform to a structure that is defined by a particular XML schema. A user may register the particular XML schema with a DBMS. In response to the registration of the particular XML schema with the DBMS, the DBMS may automatically read the data from each of the XML documents that conforms to the particular XML schema. The DBMS may automatically generate a database table that is capable of storing this data, and may automatically populate this database table with the data. For example, for each XML document that conforms to the particular XML schema, the DBMS may populate a separate row of a database table with at least a portion of the data that is contained in that XML document. Thus, separate rows of a database table may store data obtained from separate XML documents.
Usually, each such XML document represents data as one or more separate elements. For example, each XML document that conforms to the particular XML schema might have a “name” element, a “street” element, a “city” element, a “state” element, a “zip code” element, and a “phone number” element (although the actual data for each of these elements may vary between the XML documents). As the DBMS populates a database table with data obtained from the XML documents, the DBMS may store each element's data within a separate column in the database table. This differs from approaches in which all of the data from an XML document is stored within a single “large object” (or “LOB”) column. The process of storing an XML document's separate elements in separate database table columns is called “shredding.”
In an XML document, a particular element may have multiple sub-elements that are hierarchically subordinate to that particular element. For example, the “name,” “street,” “city,” “state,” “zip code,” and “phone number” elements discussed in the example above might all be sub-elements of a hierarchically superior “customer contact information” element. An element that has multiple hierarchically subordinate sub-elements is a “complex element” (as opposed to a “simple element”). When the DBMS initially generates a database table to store shredded XML data from a group of XML documents, the DBMS may attempt to create the table with enough columns to store all of the sub-elements of a particular complex element. However, for practical reasons, many DBMSs have limits on the number of columns that a single database table is permitted to have. If a particular complex element has a number of sub-elements that is greater than the number of columns that a single database table is permitted to have, then the DBMS may be unable, due to constraints, to create a database table with a separate column for each of those sub-elements. Under such circumstances, the DBMS may simply inform the user that the attempt to import the schema-conforming XML documents into the database failed.